import csv,requests,json,pandas as pd
url='http://zf.chaiyv.cn/api/kmhq.php'
response=requests.post(url)
tb=json.loads(response.text)
#print(tb['content'])
#print(len(line['content']))
#print(line['content'][113]['id'])
data_a=[]
data_b=[]
data_c=[]
for c in tb['content']:
    #print(c['id'])
    data_a.append(c['id'])
    data_b.append(c['name'])
    data_c.append('0')
path_df = pd.DataFrame()
path_df['id'] = data_a
path_df['科目名称'] = data_b
path_df['值'] = data_c
filepath = "C:\\Users\\Public\\Downloads\\demodata.csv"
path_df.to_csv(filepath, index=False, header=True)